package com.gaoxiang.Day6API.controller;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.gaoxiang.Day6API.Repository.CompanySer;
import com.gaoxiang.Day6API.entity.Company;


@RestController
public class CompanyController {
	
	 @Autowired
	private CompanySer companyser;
	
	@GetMapping("/company")
	public Collection<Company> QueryCompany() {
			return companyser.Query();
		}
	
	@PostMapping("/company")
	public void InsertCompany(@RequestBody Company company) {
		companyser.Insert(company);
	}
	
	@PutMapping("/company")
	public void UpdateCompany(@RequestBody Company company) {
		companyser.Update(company);
	}
	
	@DeleteMapping("/company/{company}")
	public void DeleteCompany(@PathVariable String company) {
		companyser.Delete(company);
	}
		
}
